package vn.isolar.system.timer;


import java.util.Timer;
import java.util.TimerTask;

import test.vn.R;

import android.content.Context;
import android.media.MediaPlayer;
import android.util.Log;

/*
 * This class will play audio while waiting for server respond.
 * 
 * Created by: Do Quoc Truong
 */
public class ScheduleTask {

	

	Timer timer;
	private MediaPlayer mPlayer;
	public ScheduleTask(Context context, int seconds,int audioFile) {
		mPlayer = MediaPlayer.create(context, audioFile);
		//toolkit = Toolkit.getDefaultToolkit();
		timer = new Timer();
		
		timer.schedule(new WaitTask(), seconds * 1000);
	}
	
	class WaitTask extends TimerTask {
		public void run() {
			mPlayer.start();
			timer.cancel(); //Not necessary because we call System.exit
			
		}
	}
	
	

}
